using System.Collections.Generic;
using UnityEngine;

public class GameControllerExample : MonoBehaviour
{
	private static string extraMessage;

	private void Start()
	{
		extraMessage = null;
		OneSignal.Init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba", "703322744261", HandleNotification);
	}

	private static void HandleNotification(string message, Dictionary<string, object> additionalData, bool isActive)
	{
		MonoBehaviour.print("GameControllerExample:HandleNotification");
		MonoBehaviour.print(message);
		if (additionalData != null)
		{
			if (additionalData.ContainsKey("discount"))
			{
				extraMessage = (string)additionalData["discount"];
			}
			else if (additionalData.ContainsKey("actionSelected"))
			{
				extraMessage = "Pressed ButtonId: " + additionalData["actionSelected"];
			}
		}
	}

	private void OnGUI()
	{
		GUIStyle gUIStyle = new GUIStyle("button");
		gUIStyle.fontSize = 30;
		GUIStyle gUIStyle2 = new GUIStyle("box");
		gUIStyle2.fontSize = 30;
		GUI.Box(new Rect(10f, 10f, 390f, 250f), "Test Menu", gUIStyle2);
		if (GUI.Button(new Rect(60f, 80f, 300f, 60f), "SendTags", gUIStyle))
		{
			OneSignal.SendTag("UnityTestKey", "TestValue");
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary.Add("UnityTestKey2", "value2");
			dictionary.Add("UnityTestKey3", "value3");
			OneSignal.SendTags(dictionary);
		}
		if (GUI.Button(new Rect(60f, 170f, 300f, 60f), "GetIds", gUIStyle))
		{
			OneSignal.GetIdsAvailable(delegate(string userId, string pushToken)
			{
				extraMessage = "UserID:\n" + userId + "\n\nPushToken:\n" + pushToken;
			});
		}
		if (extraMessage != null)
		{
			gUIStyle2.alignment = TextAnchor.UpperLeft;
			gUIStyle2.wordWrap = true;
			GUI.Box(new Rect(10f, 300f, Screen.width - 20, Screen.height - 310), extraMessage, gUIStyle2);
		}
	}
}
